package com.gm.commonlib.views.dialog.loadingDialog;

import android.app.Dialog;
import android.content.Context;

import java.lang.ref.WeakReference;

public class LoadingDialogUtil {
    static WeakReference<ILoadingDialog>  mLoadingDialog;

    private static ILoadingDialog getLoadingDialog(){
        if (mLoadingDialog==null){
            mLoadingDialog=new WeakReference<>(LoadingDialogFactory.newInstance());
        }
        return mLoadingDialog.get();
    }

    public static Dialog show(Context context,String msg, boolean cancelable) {
        return getLoadingDialog().show(context,msg,cancelable);
    }

    public static Dialog show(Context context) {
        return getLoadingDialog().show(context);
    }


    public static Dialog show(Context context, String msg) {
        return getLoadingDialog().show(context,msg);
    }

    public static void hidLoadingDialog(){
        getLoadingDialog().hid();
    }

}
